package fr.gdi.android.news.utils;

import android.content.UriMatcher;
import android.net.Uri;
import android.os.Build;
import fr.gdi.android.news.NewsProvider;
import fr.gdi.android.news.R;

public interface Constants
{
    public static final int SDK_VERSION = Integer.parseInt(Build.VERSION.SDK);
    
    public static final String PACKAGE = NewsProvider.class.getPackage().getName();
    
    public static final boolean USE_EMULATOR = false;
    
    public static final int TRIM_NEWS_AT = 123;
    
    public static final String VALID_FILENAME = "[ _\\-A-Za-z0-9]*.x[ht]*ml";
    public static final String FILENAME_KEY = "filename";
    
    public static final String VERSION = "1.4.4";
    
    public static interface Provider
    {
        static enum Columns
        {
            FEED_NAME, NEWS_LINK, NEWS_TITLE, NEWS_DATE, NEWS_DESCRIPTION, NEWS_AUTHOR, NEWS_IMAGE_URL
        }
        
        static final String[] PROJECTION_APPWIDGETS = new String[] { Columns.FEED_NAME.toString(), Columns.NEWS_LINK.toString(), Columns.NEWS_TITLE.toString(),
                Columns.NEWS_DATE.toString(), Columns.NEWS_DESCRIPTION.toString(), Columns.NEWS_AUTHOR.toString(), Columns.NEWS_IMAGE_URL.toString(),
        // Columns.FEED_COLOR.toString()
        };
        
    }
    
    public static interface ExtraTags
    {
        static final String TAG_EDIT = "TAG_EDIT";
        static final String TAG_SKIP_UPDATE = "SKIP_UPDATE";
        static final String TAG_POSITION = "position";
        static final String TAG_NAME = "name";
        static final String TAG_URL = "url";
        static final String TAG_FEEDS = "FEEDS";
        public final String TAG_AUTH = "TAG_AUTH";
        public final String TAG_PKG = "package";
        static final String TAG_COLOR = "TAG_COLOR";
        static final int URL_POS = 0;
        static final int TITLE_POS = 1;
    }
    
    public static interface URI
    {
        static final int SINGLE_FEED = 1;
        static final int WIDGET_FEEDS = 2;
        static final String AUTHORITY = Constants.PACKAGE + ".provider";
        static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
        static final Uri CONTENT_URI_FEEDS = CONTENT_URI.buildUpon().appendEncodedPath("news").build();
        static final Uri CONTENT_URI_WIDGET_FEEDS = CONTENT_URI.buildUpon().appendEncodedPath("widget").build();
        
        static final UriMatcher MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
    }
    
    public static interface Actions
    {
        static final String ACTION_NOTIFY_LOADING = Constants.PACKAGE + ".action.NOTIFY_LOADING";
        static final String ACTION_UPDATE = Constants.PACKAGE + ".action.UPDATE";
        static final String START_NOTIFICATION = Constants.PACKAGE + ".action.START_NOTIFICATION";
        static final String REFRESH_NOTIFICATION = Constants.PACKAGE + ".action.REFRESH_NOTIFICATION";
        static final String FEED_DELETED = Constants.PACKAGE + ".action.FEED_DELETED";
        
        static final String SET_CONNECTION_HEADER = Constants.PACKAGE + ".action.SET_CONNECTION_HEADER";
        static final String ADD_FEED = Constants.PACKAGE + ".action.ADD_FEED";
        static final String IMPORT = Constants.PACKAGE + ".action.IMPORT";
        static final String SHARE = Constants.PACKAGE + ".action.ACTION_SHARE";
        
        static final String NONE = Constants.PACKAGE + ".action.NONE";
    }
    
    public static interface Preferences
    {
        static final String MAX_FEEDS = "MAX_FEEDS";
        static final String FEEDS = "FEEDS";
        static final String WIDGET_PREF_SETTINGS = "news_widget_settings_";
        static final String UPDATE_INTERVAL = "UPDATE_INTERVAL";
        static final String DEFAULT_UPDATE_INTERVAL = "180"; // 3 hours
        static final String FEED_PREF = "FEED_PREF";
        static final String FEED_SEPARATOR = " FEED_DEF ";
        static final String DEFAULT_FEED_DEFINITION = "Reuters:http://feeds.reuters.com/reuters/worldNews";
        static final String WIDGET_TITLE_PREF = "WIDGET_TITLE_";
        static final String DEFAULT_TITLE_KEY = "TITLE";
        static final String CROP_DESCRIPTION_KEY = "CROP_DESCRIPTION";
        static final String USE_SYSTEM_BROWSER_KEY = "USE_SYSTEM_BROWSER";
        static final String ON_TAP_ACTION = "ON_TAP_ACTION";
        static final String HEADLINE_COLOR = "HEADLINE_COLOR";
        static final String SUMMARY_COLOR = "SUMMARY_COLOR";
        static final String FOOTER_COLOR = "FOOTER_COLOR";
        static final String WIDGET_TITLE_COLOR = "WIDGET_TITLE_COLOR";
        static final String HIDE_APPEARANCE_WARNING = "HIDE_APPEARANCE_WARNING";
        static final String BACKGROUND = "BACKGROUND";
        static final String BACKGROUND_TRANSPARENCY = "BACKGROUND_TRANSPARENCY";
        static final String APPEARANCE_KEY = "APPEARANCE";
        static final String CAPITALIZE_KEY = "CAPITALIZE";
        static final String MOBILIZER_KEY = "MOBILIZER";
        static final String MOBILIZER_SHOW_IMAGES = "MOBILIZER_SHOW_IMAGES";
        static final String HIDE_FOOTER = "HIDE_FOOTER";
        static final String TITLE_FORMAT = "TITLE_FORMAT";
        static final String LAST_UPDATE = "LAST_UPDATE_";
        static final String USE_12_HOUR = "USE_12_HOUR";
        static final String THUMB_SIZE = "THUMB_SIZE";
        static final String SHOW_IMAGES = "SHOW_IMAGES";
        static final String CLEAR_CACHE_ON_EXIT = "CLEAR_CACHE_ON_EXIT";
        static final String CACHE_TO_SD = "CACHE_TO_SD";
        static final String HIDE_HEADER = "HIDE_HEADER";
        static final String SHOW_ONGOING_NOTIFICATION = "SHOW_ONGOING_NOTIFICATION";
        static final String NOTIFICATION_COLOR = "NOTIFICATION_COLOR";
        static final String NOTIFICATION_COLOR_BLACK = "NOTIFICATION_COLOR_BLACK";
        static final String NOTIFICATION_COLOR_WHITE = "NOTIFICATION_COLOR_WHITE";
        static final String NOTIFICATION_FLASH = "NOTIFICATION_FLASH";
        static final String NOTIFICATION_VIBRATE = "NOTIFICATION_VIBRATE";
        static final String NOTIFY_ON_UPDATE = "NOTIFY_ON_UPDATE"; 
        static final String FOOTER_SIZE = "FOOTER_SIZE";
        static final String HEADLINE_SIZE = "HEADLINE_SIZE";
        static final String SUMMARY_SIZE = "SUMMARY_SIZE";
        static final String REGULAR_HEADLINE = "REGULAR_HEADLINE";
        static final String DISABLED_SHARE_ACTIVITIES = "DISABLED_SHARE_ACTIVITIES";
        static final String FETCH_WITH_GREADER = "FETCH_WITH_GREADER";
        static final String USE_REAL_AUTHOR_NAME = "USE_REAL_AUTHOR_NAME";
        static final String THUMBNAIL_AT_RIGHT = "THUMBNAIL_AT_RIGHT";
        static final String FULL_WIDTH_THUMB = "FULL_WIDTH_THUMB";
        static final String PARSE_DESCRIPTION = "PARSE_DESCRIPTION";
        static final String MIN_THUMB_WIDTH = "MIN_THUMB_WIDTH"; 
        static final String BACKGROUND_FILE = "BACKGROUND_FILE";
        static final String USE_CUSTOM_BACKGROUND = "USE_CUSTOM_BACKGROUND";
        static final String SHARE_INCLUDE_THUMBNAILS = "SHARE_INCLUDE_THUMBNAILS";
        
        
        static final String THUMB_PRIORITY = "THUMB_PRIORITY";
        
        static final int DEFAULT_WIDGET_TITLE_ID = R.string.news;
        
        static final String[] SHARED_PREFERENCES = new String[] { UPDATE_INTERVAL, ON_TAP_ACTION, MOBILIZER_KEY, CAPITALIZE_KEY, MOBILIZER_SHOW_IMAGES,
                MAX_FEEDS, CROP_DESCRIPTION_KEY, HIDE_FOOTER, TITLE_FORMAT, USE_12_HOUR, HEADLINE_COLOR, SUMMARY_COLOR, FOOTER_COLOR, WIDGET_TITLE_COLOR,
                BACKGROUND, SHOW_IMAGES, CLEAR_CACHE_ON_EXIT, DISABLED_SHARE_ACTIVITIES, MIN_THUMB_WIDTH, THUMBNAIL_AT_RIGHT, 
                PARSE_DESCRIPTION, };
        
        static final String[] PER_WIDGET_PREFERENCES = new String[] { HEADLINE_COLOR, SUMMARY_COLOR, FOOTER_COLOR, WIDGET_TITLE_COLOR, BACKGROUND, MAX_FEEDS,
                CROP_DESCRIPTION_KEY, CAPITALIZE_KEY, HIDE_FOOTER, TITLE_FORMAT, USE_12_HOUR, HIDE_HEADER, REGULAR_HEADLINE };
    }
    
    public static interface Configuration
    {
        // configured widget flag
        static final String LIVE_WIDGET = "LIVE_WIDGET";
        
        // default tap actions
        static final String USE_BUILTIN_BROWSER = "USE_BUILTIN_BROWSER";
        static final String DO_NOTHING_ON_TAP = "DO_NOTHING_ON_TAP";
        
        // default backgrounds
        static final String DARK = "DARK";
        static final String LIGHT = "LIGHT";
        static final String TRANSPARENT = "TRANSPARENT";
        static final String NO_BACKGROUND = "NO_BACKGROUND";
        static final String BLACK = "BLACK";
        static final String WHITE = "WHITE";
        
        static final String SUMMARY = "SUMMARY";
        static final String ENCLOSURE = "ENCLOSURE";
        
        static final String SQUARE_CORNERS = "SQUARE_CORNERS"; 
        
        // mobilizers
        static final String GOOGLE = "GOOGLE";
        static final String INSTAPAPER = "INSTAPAPER";
        static final String INSTAPAPER_TEXT = "INSTAPAPER_TEXT";
        static final String NO_MOBILIZER = "NO_MOBILIZER";
        
        static final String DEFAULT_TITLE_FORMAT = "%t (%d %M, %h:%m)";
        
        static final String IMPORT_FROM_FILE = "IMPORT_FROM_FILE";
    }
    
    public static interface Log
    {
        static final String EMAIL_TO = "gdodinet@gmail.com";
        static final String EMAIL_SUBJECT = "Scrollable News Feedback";
    }
}
